<%@ page import="org.apache.ibatis.session.SqlSession" %>
<%@ page import="myschool.mybatisUtil.MybatisUtil" %>
<%@ page import="com.github.pagehelper.PageHelper" %>
<%@ page import="myschool.entity.Student" %>
<%@ page import="java.util.List" %>
<%@ page import="myschool.dao.GradeDao" %>
<%@ page import="myschool.entity.Grade" %>
<%@ page import="myschool.dao.SubjectDao" %>
<%@ page import="myschool.entity.Subject" %><%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2023/6/5
  Time: 17:33
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
</head>
<body>
<form action="../jsp6-5/addSubject.jsp" method="post">
    <div>
        <input type="submit" value="添加新课程">
    </div>
</form>
<table border="1">
<%
    SqlSession s= MybatisUtil.get();
    SubjectDao mapper = s.getMapper(SubjectDao.class);
    PageHelper.startPage(1,70);
    List<Subject> subjects = mapper.findAll();
    MybatisUtil.close(s);
    for(Subject subject:subjects) {
%>
<tr>
    <td><%=subject.getId()%></td>
    <td><%=subject.getSubjectname()%></td>
    <td><%=subject.getClasshour()%></td>
    <td><%=subject.getGradeid()%></td>
    <td><a href="changeSubject.jsp?subjectId=<%=subject.getId()%>">编辑</a> </td>
    <td><a href="delSubject.jsp?subjectId=<%=subject.getId()%>">删除</a> </td>
</tr>
<%}%>
</table>
</body>
</html>
